|
|
|
|
|
|
|
Dim objWS As Workspace
Dim objItem As Object
Dim strMsg As String
'
strMsg = ""
For Each objWS In DBEngine.Workspaces
For Each objItem In objWS.Properties
strMsg = strMsg & objItem.Name
strMsg = strMsg & " = "
strMsg = strMsg & objItem.Value
strMsg = strMsg & " {"
strMsg = strMsg & ShowType(objItem.Type) & "}"
strMsg = strMsg & vbCrLf
Next
'
MsgBox strMsg, vbInformation, "Workspaces"
'
Next
'
Exit Sub
'
LocalErr:
strMsg = strMsg & "<err>"
Resume Next
'
End Sub |
|
|
|
|
|
|
|
|
The code in Listing 9.6 should look familiar to you. It is almost identical to the code used to enumerate the DBEngine properties. The only change that has been made is that you now have two For ... Each loops in the routine. The outer loop walks through all defined workspaces in the Workspace collection. The inner loop walks through all the properties of the selected Workspace object. |
|
|
|
|
|
|
|
|
Save and run the program. When you click on the Workspace button, the program lists all the properties of the object. Your screen should look like Figure 9.5. |
|
|
|
|
|
|
|
|
Figure 9.5.
Enumerating the Workspace
object properties. |
|
|
|
|
|
|
|
|
Creating a New Workspace Object |
|
|
|
|
|
|
|
|
You can create new Workspace objects using the CreateWorkspace method of the DBEngine. Even though Visual Basic 5 creates and uses a default Workspace object when you first begin database operations, you should create an explicit, named Workspace from within Visual |
|
|
|
|
|